package com.softline.documentsmall.service.impl;

import com.softline.documentsmall.dao.SpecialDictionaryMapper;
import com.softline.documentsmall.entity.SpecialDictionary;
import com.softline.documentsmall.entity.SpecialDictionaryVO;
import com.softline.documentsmall.service.SpecialDictionaryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @program: documentsmall
 * @description: 特色词条service
 * @author: wmj
 * @create: 2020-12-07
 * @ClassName: SpecialDictionaryServiceImpl
 */
@Service
@Slf4j
public class SpecialDictionaryServiceImpl implements SpecialDictionaryService {

    @Autowired
    SpecialDictionaryMapper specialDictionaryMapper;

    @Override
    public List<SpecialDictionaryVO> listByLanguage(String type) {
        return specialDictionaryMapper.listByLanguage(type);
    }

    @Override
    public int add(SpecialDictionary specialDictionary) {
        SpecialDictionary dictionary = specialDictionaryMapper.select(specialDictionary.getDictionaryId());
        int result = 0;
        if(dictionary!=null){
            return result;
        }else {
            int insert = specialDictionaryMapper.insert(specialDictionary);
            return  insert;
        }
    }

    @Override
    public void delete(Integer id) {
        specialDictionaryMapper.deleteByPrimaryKey(id);
    }
}
